package com.aaa.dao;

import com.aaa.pojo.BankNumber;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

@Mapper
@Repository
//银行卡接口
public interface BankNumberDao {
    //根据Uid查询银行名称，银行卡类型，查询银行卡号
    List<BankNumber> queryBankByUid(Integer uid);
    //查询银行名称，银行卡类型，查询银行卡号
    List<BankNumber> queryBankNumberAll(@Param("uid")Integer uid);

    //根据银行卡编号查询银行名称，银行卡类型，查询银行卡号
    BankNumber selByBankID(Integer bank_id);

    //根据银行卡编号修改
    @Update("update bank_number set bank_card=#{bank_card},tid=#{tid},b_id=#{b_id} where bank_id=#{bank_id}")
    Boolean updByBankID(@Param("bank_card")String bank_card,@Param("tid")Integer tid,@Param("b_id")Integer b_id,@Param("bank_id")Integer bank_id);

    //根据银行卡编号删除
    @Delete("delete from bank_number where bank_id=#{bank_id}")
    Boolean delByBankID(Integer bank_id);

    //添加银行名称，银行卡类型，查询银行卡号
    @Insert("insert into bank_number(bank_card,tid,b_id,money,uid) value(#{bank_card},#{tid},#{b_id},10000,#{uid})")
    Boolean addBankNumber(@Param("bank_card")String bank_card,@Param("tid")Integer tid,@Param("b_id")Integer b_id,@Param("uid")Integer uid);
//    根据银行卡编号增加赎回金额
    Boolean addMoneyById(Integer Bank_id,Double money);
//    根据银行卡编号减少还清金额
    Boolean minusMoneyById(Integer Bank_id,Double money);
}